package ru.susu.algebra.partition;

import java.util.Iterator;

/**
 * @author akargapolov
 * @since: 09.03.2010
 */
public class PartitionsIterator implements Iterator<Partition>
{
	private Integer _number;
	private Integer _current;
	private Long _all;

	public PartitionsIterator(Integer number)
	{
		_number = number;
		_current = 0;
		_all = PartitionEnumerator.getPartitionsNumber(_number);
	}

	@Override
	public boolean hasNext()
	{
		return _current < _all;
	}

	@Override
	public Partition next()
	{
		return PartitionsFactory.createPartition(_current++, _number);
	}

	@Override
	public void remove()
	{
		throw new RuntimeException("I can't do it!!!");
	}

}
